//
//  RSWRESTService+AddressBookContact.m
//  RSW.IOS
//
//  Created by zhaiqiuqiu on 16/12/29.
//  Copyright © 2016年 com.xtion.crm. All rights reserved.
//

#import "RSWRESTService+AddressBookContact.h"

@implementation RSWRESTService (AddressBookContact)

-(XLGResult*)getCommonAddressBookContact:(NSString*)token
{
    NSString *URI = [NSString stringWithFormat:@"api/communication?token=%@", token];
    
    XLGResult *r = [self HTTPRESTRequestURI:URI dicData:nil HTTPMethod:XLGHTTPMethodTypeGet];
    
    if(r.outResult == YES)
    {
        NSArray *list = r.outObj[@"List"];
        
        XMSQueueDictionary *qdSet = [CommonAddressBookContactInfo JSONObjectProperty:nil];
        list =[CTransformHTTPRESTObj JSONObjs:list transformToProtocolObj:[CommonAddressBookContactInfo class] accordingToColPropertyPair:qdSet];
        
        r = [XLGResult resultWithOutResult:YES outObj:list];
    }
    return r;
}

-(XLGResult*)getPrivateAddressBookContact:(NSString*)token
{
    NSString *URI = [NSString stringWithFormat:@"api/personcommunication?token=%@", token];
    
    XLGResult *r = [self HTTPRESTRequestURI:URI dicData:nil HTTPMethod:XLGHTTPMethodTypeGet];
    
    if(r.outResult == YES)
    {
        NSArray *list = r.outObj[@"List"];
        
        XMSQueueDictionary *qdSet = [PrivateAddressBookContactInfo JSONObjectProperty:nil];
        list =[CTransformHTTPRESTObj JSONObjs:list transformToProtocolObj:[PrivateAddressBookContactInfo class] accordingToColPropertyPair:qdSet];
        
        r = [XLGResult resultWithOutResult:YES outObj:list];
    }
    return r;
}

@end
